let that;
let mask;
storBattery = new Vue({
	el: "#storBattery",
	data: {
		currentUser:'', // 当前用户信息
		batteryTypeList: [], // 电池类型
		batteryGroupList: [], // 电池组别
		storageBattery: '', // 合并蓄电池用于前台展示
		testStaffCodeName: '',//测试人编号姓名
		tutelageStaffCodeName: '',//监护人编号姓名
		time: '',//合并测量时间用于前台展示
		parentObject: {}, // 前一个页面传参
		active: "", // 当前节点
		workType: '', // 流程类型
		isView: false, // 是否可编辑
		isSaveVisable: false,//是否显示保存按钮
		isSubVisable: false,//是否显示提交按钮
		isBackVisable: false,//是否显示退回按钮
		isConfVisable: false,//是否显示确认按钮
		isPassVisable: false,//是否显示通过按钮
		batterNum:"1",//电池编号
		batterPosition:0,//电池下标
		dyNum:"2.22",//电压输入弹出框数值
		batteryForm: {
			storbatteryCheckId: '',//蓄电池测量记录主键
			workId: '',//工作主键
			workDesc: '',//工作描述
			testStaffCode: '',// 测试人编号
			testStaffName: '',//测试人姓名
			tutelageStaffCode: '',//监护人编号
			tutelageStaffName: '',//监护人姓名
			begTime: '',//测量时间起
			endTime: '',//测量时间止
			storageBatteryType: '',// 蓄电池类型
			storageBatteryGroup: '',//蓄电池组别
			storageBatteryCount: '',//电池数量
			acVoltage: '',//交流电压
			acCurrent: '',//交流电流
			voltageLowerLimit: '',//标准电压下限
			voltageUpperLimit: '',//标准电压上限
			temperature: '',//温度
			busVoltage: '',//母线电压
			chargingCurrent: '',//充电电流
			roomTemperature: '',//室温
			measureVoltage: [],//测量电压,json形式保存
			measureResult: '',//测量结果 0:异常 1:正常
			abnormalBatteryCode: [],//问题电池编号,逗号分隔
			measureDesc: '',//测量结论
			remark: '',//备注
			client: '',//客户ID
			dataSource: 'NEIOS_APP'+localStorage.getItem("currVersion"),//数据来源
			status: '',//业务状态
			dataStatus: '',//是否有效 参见码表0删除&1正常
			createBy: '',//创建人员
			createStaffName: '',//创建人姓名
			createDate: '',//创建时间
			modifyBy: '',//修改人员
			modifyStaffName: '',//修改人员姓名
			modifyDate: '',//修改时间
			mask:{},
		},
		
		questionArrary: [],//缺陷记录
		isShow: false,
		showCheck: false,//显示审批人
		showDes: true,//显示意见框
		backOrAgree: '',//点击通过还是退回打开弹窗
		submitSwitch: {
			questionArrary: [],
			confirmPerson: '',
			desc: '',
			confirmPersonCode: [],
			confirmPersonName: [],
			strCode: '',
			strName: ''
		},
		submitParams:'',
	},
	components:{
		processlog, // 流程日志
		personselect		
	},
	created: function() {
		that = this;
		let _this = this
		_this.currentUser = JSON.parse(localStorage.getItem("neiosUser"))
		_this.parentObject = JSON.parse(localStorage.getItem("todoWork")).obj
		_this.active = _this.parentObject.workStatus;
		_this.workType = _this.parentObject.workType; 
		if (_this.parentObject.isView) {
			_this.isView = _this.parentObject.isView;
			_this.isSaveVisable = false // 保存按钮
			_this.isSubVisable = false // 提交按钮
			_this.isBackVisable = false // 退回按钮
			_this.isConfVisable = false // 确认按钮
			_this.isPassVisable = false // 通过按钮
		} else if (this.active == '20') {
			this.isSaveVisable = true;
			this.isSubVisable = true;
			this.isBackVisable = false;
			this.isConfVisable = false;
			this.isPassVisable = false;
		} else if (this.active == '30') {
			this.isSaveVisable = true;
			this.isSubVisable = false;
			this.isBackVisable = true;
			this.isConfVisable = true;
			this.isPassVisable = false;
		} else if (this.active == '40') {
			this.isSaveVisable = false;
			this.isSubVisable = false;
			this.isBackVisable = true;
			this.isConfVisable = false;
			this.isPassVisable = true;
			this.isView = true;
		}
		// 获取码表
		let dictCodes = 'BATTERY_TYPE,STORBATTARY_GROUP_TYPE';
		mui.neiosCommon.queryDict(dictCodes,function(data){
			if (data != '') {
				_this.batteryTypeList = data.BATTERY_TYPE 
				_this.batteryGroupList = data.STORBATTARY_GROUP_TYPE
				_this.queryDetail() // 查询详情
			}
		})
	},
	methods: { 
		//上一条数据
		lastData(){
			that.batterPosition = (that.batterPosition - 1) <= 0 ? 0 : that.batterPosition - 1;
			that.dyNum = that.batteryForm.measureVoltage[that.batterPosition].voltage;
			console.log("==========>"+that.batterPosition)
		},
		//确认数据
		setData(){
			alert("A")
			that.batteryForm.measureVoltage[that.batterPosition].voltage = that.dyNum;
			mui.toast("已保存");
			that.showAbnormalInfo()
			that.nextData()
		},
		//下一条数据
		nextData(){
			that.batterPosition = (that.batterPosition + 1) >= that.batteryForm.measureVoltage.length ? that.batteryForm.measureVoltage.length-1 : that.batterPosition + 1;
			that.dyNum = that.batteryForm.measureVoltage[that.batterPosition].voltage;
			console.log(that.batterPosition)
		},
		//校验
		check_price(){
			that.dyNum = (that.dyNum.match(/^\d*(\.?\d{0,3})/g)[0]) || null
		},
		checkPriceItem(position){
			if(null !=  position){
				this.batteryForm.measureVoltage[position].voltage = (this.batteryForm.measureVoltage[position].voltage.match(/^\d*(\.?\d{0,3})/g)[0]) || null				
			}
		},
		//打开遮罩层
		openMask(){
			mask = mui.createMask(function(ret){
				console.log(JSON.stringify(ret))
			});
			mask.show();
		},
		// 表单校验
		checkInput (val,e,type) {
			let testStr = ''
			let toastTxt = ''
			if (type == '0') {
				testStr = /^\d{1,12}$|^\d{1,12}[.]\d{1,4}$/
				toastTxt = '请输入正数且整数位最多12位，小数位最多4位'
			} else {
				testStr = /^\+?[1-9][0-9]*$/
				toastTxt = '请输入非零的正整数'
			}
			if (!testStr.test(val)) {
				this.batteryForm[e] = ''
				$('input[name='+e+']').addClass('erro')
				$('input[name='+e+']').focus()
				mui.toast(toastTxt)
			} else {
				$('input[name='+e+']').removeClass('erro')
			}
			// 电池数量改变，执行循环生成input操作
			if (e == 'storageBatteryCount') {
				this.createInput()
			}
		},
		// 查询详情
		queryDetail () {
			let _this = this
			let param = {
				workId:this.parentObject.workId
			}
			mui.neiosRequst.httpRequst('/app/regularWork/neiosStorbatteryCheck/queryStorbatteryRecord', param,
				function(data) {
					if (data.code == '0') {
						_this.batteryForm = JSON.parse(JSON.stringify(data.data));
						if (data.data.measureVoltage == null || data.data.measureVoltage == '') {
							_this.batteryForm.measureVoltage = [];
						} else {
							_this.batteryForm.measureVoltage = JSON.parse(data.data.measureVoltage);
						}
						if (data.data.abnormalBatteryCode == null || data.data.abnormalBatteryCode == '') {
							_this.batteryForm.abnormalBatteryCode = [];
						} else {
							_this.batteryForm.abnormalBatteryCode = data.data.abnormalBatteryCode.split(',');
						}
						
						if (_this.active == '20') {
							_this.batteryForm.testStaffCode = _this.currentUser["userId"];
							_this.batteryForm.testStaffName = _this.currentUser["name"];
							_this.testStaffCodeName = _this.currentUser["userName"];
							if (data.data.testStaffCode.toUpperCase() != _this.currentUser["userId"].toUpperCase()) {
								_this.batteryForm.tutelageStaffCode = data.data.testStaffCode;
								_this.batteryForm.tutelageStaffName = data.data.testStaffName;
								_this.tutelageStaffCodeName = `[${data.data.testStaffCode}]${data.data.testStaffName}`;
							} else {
								_this.batteryForm.tutelageStaffCode = data.data.tutelageStaffCode;
								_this.batteryForm.tutelageStaffName = data.data.tutelageStaffName;
								_this.tutelageStaffCodeName = `[${data.data.tutelageStaffCode}]${data.data.tutelageStaffName}`;
							}
						} else {
							_this.testStaffCodeName = `[${data.data.testStaffCode}]${data.data.testStaffName}`;
							_this.tutelageStaffCodeName = `[${data.data.tutelageStaffCode}]${data.data.tutelageStaffName}`;
						}
						// _this.testStaffCodeName = `[${data.data.testStaffCode}]${data.data.testStaffName}`;
						// _this.tutelageStaffCodeName = `[${data.data.tutelageStaffCode}]${data.data.tutelageStaffName}`;
						if (data.data.endTime == null || data.data.endTime == '') {
							_this.batteryForm.endTime = mui.neiosCommon.transTime(new Date());
						}
						_this.batteryForm.begTime = _this.batteryForm.begTime.replace(/-/g, '/');
						_this.batteryForm.endTime = _this.batteryForm.endTime.replace(/-/g, '/');
						let newBegTime = mui.neiosCommon.transTime(new Date(_this.batteryForm.begTime),'day');
						let newEndTime = mui.neiosCommon.transTime(new Date(_this.batteryForm.endTime),'day');
						_this.time = `${newBegTime}~${newEndTime}`;
						let bType;
						_this.batteryTypeList.map(v => {
							if (_this.batteryForm.storageBatteryType == v.itemValue) {
								bType = v.itemText;
							} 
						});
						let bGroup;
						_this.batteryGroupList.map(va => {
							if (_this.batteryForm.storageBatteryGroup == va.itemValue) {
								bGroup = va.itemText;
							}
						});
						_this.storageBattery = `${bType}-${bGroup}`;
						if (data.data.storageBatteryCount == null || data.data.storageBatteryCount == '') {
							_this.queryIsFirst(_this.batteryForm.storageBatteryType, _this.batteryForm.storageBatteryGroup);
						} else {
							_this.batteryForm.storageBatteryCount = data.data.storageBatteryCount.toString();
						}
						_this.showAbnormalInfo();
					} else {
						mui.toast('获取数据失败,请稍后再试！')
					}
				},
				function() {
					mui.toast('获取数据失败,请稍后再试！')
				}
			);
		},
		// 查询蓄电池组是否为第一次测量
		queryIsFirst (type, group) {
			let _this = this;
			let params = {
				storageBatteryType: type,
				storageBatteryGroup: group,
				stationCode: localStorage.getItem('neiosStationCode'),
			}
			mui.neiosRequst.httpRequst('/app/regularWork/neiosStorbatteryCheck/queryStorbatteryIsFirst', params,
				function(result) {
					if (result.code == '0') {
						 //如果是第一次，测量数量给默认值，不是第一次，测量数量给上一次的数量
						if (result.isFirst == true) {
							if (type == '1') {
								_this.batteryForm.storageBatteryCount = '103';
							} else {
								_this.batteryForm.storageBatteryCount = '24';
							}
							_this.createInput();
						} else {
							_this.batteryForm.storageBatteryCount = result.count;
							_this.createInput();
							_this.batteryForm.voltageLowerLimit = result.lower;
							_this.batteryForm.voltageUpperLimit = result.upper;
						}
					} else {
						mui.toast('查询列表失败，请稍后重试！')
					}
				},
				function() {
					mui.toast('查询列表失败，请稍后重试！')
				}
			);
		},
		//生成测量需要的input框
		createInput: function () {
			let _this = this;
			_this.batteryForm.measureDesc = '';
			_this.batteryForm.measureVoltage = []
			for (let i = 0; i < _this.batteryForm.storageBatteryCount; i++) {
				_this.batteryForm.measureVoltage.push({ voltage: '2.22_' });
			}
		},
        //删除下划线
        delUnderscore: function (index) {
            let _this = this;
            _this.batteryForm.measureVoltage[index].voltage = _this.batteryForm.measureVoltage[index].voltage.replace("_", "");
        },
		//电压异常提示并保存 
		showAbnormalInfo () {
			let _this = this;
			_this.batteryForm.abnormalBatteryCode = [];
			let obj = JSON.parse(JSON.stringify(_this.batteryForm));
			obj.measureVoltage.map(v => {
				if (v.voltage == '2.22_') {
					v.voltage = 2.22
				}
				else{
					v.voltage = Number(v.voltage)
				}
			});
			
			for (let i = 0; i < obj.measureVoltage.length; i++) {
				if ((obj.measureVoltage[i].voltage < _this.batteryForm.voltageLowerLimit || obj.measureVoltage[i].voltage > _this.batteryForm.voltageUpperLimit)) {
					_this.batteryForm.abnormalBatteryCode.push(i + 1);
				}
			}
			if (_this.batteryForm.abnormalBatteryCode.length > 0) {
				_this.batteryForm.measureDesc = _this.batteryForm.abnormalBatteryCode + '号电压异常';
			} else {
				_this.batteryForm.measureDesc = _this.batteryForm.measureDesc;
			}
		},
		// 非空校验
		checkNonEmpty () {
			let erroNum = 0
			let checkList = [
				'voltageLowerLimit',
				'voltageUpperLimit',
				'temperature',
				'storageBatteryCount',
				'acVoltage',
				'acCurrent',
				'busVoltage',
				'chargingCurrent',
				'roomTemperature',
			]
			for (let item of checkList) {
				if (this.batteryForm[item] == '' || 
				this.batteryForm[item] == null) {
					$('input[name='+item+']').addClass('erro')
					erroNum++
				}
			}
			if (this.batteryForm.measureDesc == '' || 
				this.batteryForm.measureDesc == null) {
				$('textarea[name=measureDesc]').addClass('erro')
				erroNum++
			}
			for (let vol=0; vol < this.batteryForm.measureVoltage.length; vol++) {
				if (this.batteryForm.measureVoltage[vol].voltage == '' ||
				this.batteryForm.measureVoltage[vol].voltage == null) {
					$('input[name=voltage'+vol+']').addClass('erro')
					erroNum++
				}
			}
			if (erroNum > 0) {
				return false
			} else {
				return true
			}
		},
		// 保存
		save () {
			let _this = this;
			_this.batteryForm.status = '21';//21代表业务状态是保存
			_this.batteryForm.dataStatus = "1";
			_this.batteryForm.dataSource = "NEIOS_APP"+localStorage.getItem("currVersion");
			_this.batteryForm.client = "NEIOS";
			_this.batteryForm.createBy = _this.currentUser.userId;
			_this.batteryForm.createStaffName = _this.currentUser.name;
			_this.batteryForm.workDesc = "进行蓄电池组电压测量并提交测量结果";
			_this.batteryForm.modifyBy = _this.currentUser.userId;
			_this.batteryForm.modifyStaffName = _this.currentUser.name;
			let obj = JSON.parse(JSON.stringify(_this.batteryForm));
			if (obj.abnormalBatteryCode.length == 0) {
				obj.abnormalBatteryCode = '';
			} else {
				obj.abnormalBatteryCode = obj.abnormalBatteryCode.join(',')
			}
			obj.measureVoltage = JSON.stringify(obj.measureVoltage);
			let params = { "batteryForm": obj }
			mui.neiosRequst.httpRequst('/app/regularWork/neiosStorbatteryCheck/saveOrUpdateStorbatteryCheck', params,
				function(data) {
					if (data.code == '0') {
						mui.toast('保存成功！')
					} else {
						mui.toast('保存失败，请稍后重试！')
					}
				},
				function() {
					mui.toast('保存失败，请稍后重试！')
				}
			);
		},
		// 提交
		submit () {
			let _this = this;
			if (this.checkNonEmpty()) {
				let obj = JSON.parse(JSON.stringify(_this.batteryForm));
				obj.measureVoltage.map((v, i) => {
					if (v.voltage == '2.22_') {
						v.voltage = '2.22'
					}
				});
				if (_this.batteryForm.abnormalBatteryCode.length > 0) {
					let num;
					
						
					_this.batteryForm.abnormalBatteryCode.map(val => {
						console.log("当前电压值:"+obj.measureVoltage[val - 1].voltage+">>>标准电压值:"+_this.batteryForm.voltageUpperLimit)
						if (obj.measureVoltage[val - 1].voltage > _this.batteryForm.voltageUpperLimit) {
							num = (obj.measureVoltage[val - 1].voltage) * 10000 - (_this.batteryForm.voltageUpperLimit) * 10000;
							_this.questionArrary.push({ name: `${val}号蓄电池电压高于标准范围${(num / 10000).toFixed(4)}V` });
						} else if(obj.measureVoltage[val - 1].voltage < _this.batteryForm.voltageLowerLimit){
							console.log("当前电压值:"+obj.measureVoltage[val - 1].voltage+"。。当前低压值:"+_this.batteryForm.voltageLowerLimit)
							num = (_this.batteryForm.voltageLowerLimit) * 10000 - (obj.measureVoltage[val - 1].voltage) * 10000;
							_this.questionArrary.push({ name: `${val}号蓄电池电压低于标准范围${(num / 10000).toFixed(4)}V` });
						}
					})
				}
				_this.isShow = true;
				_this.showCheck = false;
				_this.showDes = false;
				_this.backOrAgree = "submit";
			} else {
				alert('请将表单填写完整！')
			}
		},
		//退回
		sendBack() {
			//工作项信息
			this.workInfo = {
				workId: this.parentObject.workId,
				workType: this.parentObject.workType,
				workDesc: this.parentObject.workDesc,
				workStatus: this.parentObject.workStatus
			};
			let _this = this;
			let obj = JSON.parse(JSON.stringify(_this.batteryForm));
			obj.measureVoltage.map((v, i) => {
				if (v.voltage == '2.22_') {
					v.voltage = '2.22'
				}
			});
			if (_this.batteryForm.abnormalBatteryCode.length > 0) {
				let num;
				_this.batteryForm.abnormalBatteryCode.map(val => {
					if (obj.measureVoltage[val - 1].voltage > _this.batteryForm.voltageUpperLimit) {
						num = (obj.measureVoltage[val - 1].voltage) * 10000 - (_this.batteryForm.voltageUpperLimit) * 10000;
						_this.questionArrary.push({ name: `${val}号蓄电池电压高于标准范围${(num / 10000).toFixed(4)}V` });
					} else if(obj.measureVoltage[val - 1].voltage < _this.batteryForm.voltageLowerLimit){
						num = (_this.batteryForm.voltageLowerLimit) * 10000 - (obj.measureVoltage[val - 1].voltage) * 10000;
						_this.questionArrary.push({ name: `${val}号蓄电池电压低于标准范围${(num / 10000).toFixed(4)}V` });
					}
				})
			}
			if (obj.abnormalBatteryCode.length == 0) {
				obj.abnormalBatteryCode = '';
			} else {
				obj.abnormalBatteryCode = obj.abnormalBatteryCode.join(',')
			}
			obj.measureVoltage = JSON.stringify(obj.measureVoltage);
			this.submitParams = { "batteryForm": obj }
			this.isShow = true;
			this.showCheck = false;
			this.showDes = true;
			this.backOrAgree = "back";
		},
		//通过
		pass() {
			//工作项信息
			this.workInfo = {
				workId: this.parentObject.workId,
				workType: this.parentObject.workType,
				workDesc: this.parentObject.workDesc
			};
			let _this = this;
			let obj = JSON.parse(JSON.stringify(_this.batteryForm));
			obj.measureVoltage.map((v, i) => {
				if (v.voltage == '2.22_') {
					v.voltage = '2.22'
				}
			});
			if (_this.batteryForm.abnormalBatteryCode.length > 0) {
				let num;
				_this.batteryForm.abnormalBatteryCode.map(val => {
					if (obj.measureVoltage[val - 1].voltage > _this.batteryForm.voltageUpperLimit) {
						num = (obj.measureVoltage[val - 1].voltage) * 10000 - (_this.batteryForm.voltageUpperLimit) * 10000;
						_this.questionArrary.push({ name: `${val}号蓄电池电压高于标准范围${(num / 10000).toFixed(4)}V` });
					} else if(obj.measureVoltage[val - 1].voltage < _this.batteryForm.voltageLowerLimit) {
						num = (_this.batteryForm.voltageLowerLimit) * 10000 - (obj.measureVoltage[val - 1].voltage) * 10000;
						_this.questionArrary.push({ name: `${val}号蓄电池电压低于标准范围${(num / 10000).toFixed(4)}V` });
					}
				})
			}
			if (obj.abnormalBatteryCode.length == 0) {
				obj.abnormalBatteryCode = '';
			} else {
				obj.abnormalBatteryCode = obj.abnormalBatteryCode.join(',')
			}
			obj.measureVoltage = JSON.stringify(obj.measureVoltage);
			this.submitParams = { "batteryForm": obj }
			this.isShow = true;
			this.showDes = true;
			if (this.active == '30') {
				this.showCheck = true;
			}
			this.backOrAgree = "pass";
		},
		// 关闭提交窗口
		cancelForm () {
			this.isShow = false;
			this.submitSwitch.desc = ''
			this.questionArrary = [];
		},
		// 提交窗口确定
		submitForm () {
			let _this = this;
			if (this.backOrAgree == "submit") { // 提交状态
				_this.batteryForm.status = '32';//32代表业务状态是提交
				_this.batteryForm.dataStatus = "1";
				_this.batteryForm.dataSource = "NEIOS_APP"+localStorage.getItem("currVersion");
				_this.batteryForm.client = "NEIOS";
				_this.batteryForm.createBy = _this.currentUser.userId;
				_this.batteryForm.createStaffName = _this.currentUser.name;
				_this.batteryForm.workDesc = "进行蓄电池组电压测量并提交测量结果";
				_this.batteryForm.modifyBy = _this.currentUser.userId;
				_this.batteryForm.modifyStaffName = _this.currentUser.name;
				let obj = JSON.parse(JSON.stringify(_this.batteryForm));
				if (obj.abnormalBatteryCode.length == 0) {
					obj.abnormalBatteryCode = '';
				} else {
					obj.abnormalBatteryCode = obj.abnormalBatteryCode.join(',')
				}
				obj.measureVoltage.map(v => {
					if (v.voltage == '2.22_') {
						v.voltage = '2.22'
					}
				})
				obj.measureVoltage = JSON.stringify(obj.measureVoltage);
				let params = {
					"batteryForm": obj,
					"areaCompanyCode": _this.currentUser.companyCode,
					"stationCode": localStorage.getItem('neiosStationCode'),
					"workType": '0101',
					"questionArr": _this.questionArrary,
					"model": _this.storageBattery,
					"userId":_this.currentUser.userId,
					"userName":_this.currentUser.name,
				}
				mui.neiosRequst.httpRequst('/app/regularWork/neiosStorbatteryCheck/submitStorbatteryCheck', params,
					function(data) {
						if (data.code == '0') {
							mui.toast('提交成功！')
							setTimeout(function() {
								mui.back()
								let page = plus.webview.getWebviewById("../sitOperation/terminalwork/terminalwork.html");
								let pageId = plus.webview.getWebviewById(page.id); 
								let param = {} 
								param.isRefresh = true
								mui.fire(pageId, 'isRefresh', param);
							}, 500);
						} else {
							mui.toast('提交失败，请稍后重试！')
						}
					},
					function() {
						mui.toast('提交失败，请稍后重试！')
					}
				);
			} else if (this.backOrAgree == "back") { // 退回
				var btnArray = ['取消', '确定'];
				mui.confirm('是否确认提交退回？', '提示', btnArray, function(e) {
				    if (e.index == 1) {
						if (_this.submitSwitch.desc == '' || 
						_this.submitSwitch.desc == null) {
							$('textarea[name=desc]').addClass('erro')
							mui.toast('请填写审批意见')
							return false
						} else {
							let param = {
								"workId": _this.workInfo.workId,
								"workType": _this.workInfo.workType,
								"workDesc": _this.workInfo.workDesc,
								"nodeDealStaffCode": _this.currentUser.userId,
								"nodeDealStaffName": _this.currentUser.name,
								"approveDes": _this.submitSwitch.desc,
								"nodeDealStaffRole": _this.workInfo.workStatus == '30'?'1':'2',//30监护人退回给操作人40审批人退回给监护人
								"forwardNode": '1',
								"nodeVisibleRange": '20',
								"params":_this.submitParams
							};
							mui.neiosRequst.httpRequst('/app/personWork/sendBack', param,
								function(data) {
									if (data.code == '0') {
										mui.toast('退回成功！')
										setTimeout(function() {
											mui.back()
											let page = plus.webview.getWebviewById("../sitOperation/terminalwork/terminalwork.html");
											let pageId = plus.webview.getWebviewById(page.id); 
											let param = {} 
											param.isRefresh = true
											mui.fire(pageId, 'isRefresh', param);
										}, 500);
									} else {
										mui.toast('退回失败，请稍后重试！')
									}
								},
								function() {
									mui.toast('退回失败，请稍后重试！')
								}
							);
						}
				    } else {
						return false;
					}
				})
			} else if (this.backOrAgree == "pass") {
				// if (_this.submitSwitch.desc == '' ||
				// _this.submitSwitch.desc == null) {
				// 	mui.toast('请填写意见描述！')
				// 	return false
				// }
				if (!_this.showCheck) {
					_this.submitSwitch.strCode = _this.currentUser.userId;
					_this.submitSwitch.strName = _this.currentUser.name;
				} else {
					if (_this.$refs.person.personids == '' ||
					_this.$refs.person.personids == null) {
						mui.toast('请选择审核人！')
						return false
					}
					// 需要选择审批人
					_this.submitSwitch.strCode = _this.$refs.person.personids;
					_this.submitSwitch.strName = '';
					let personName = _this.$refs.person.person.split(',')
					for (let personItem of personName) {
						let el = personItem.substring(personItem.indexOf("]")+1)
						_this.submitSwitch.strName += el + ','
					}
					_this.submitSwitch.strName = _this.submitSwitch.strName.substring(0,_this.submitSwitch.strName.length-1)
				}
				let param = {
					"workId": _this.workInfo.workId,
					"workType": _this.workInfo.workType,
					"workDesc": _this.workInfo.workDesc,
					"companyCode": _this.currentUser.companyCode,
					"stationCode": localStorage.getItem('neiosStationCode'),
					"approveDes": _this.submitSwitch.desc,
					"confirmPersonCode": _this.submitSwitch.strCode,
					"confirmPersonName": _this.submitSwitch.strName,
					"userId":_this.currentUser.userId,
					"userName":_this.currentUser.name,
					"params":_this.submitParams
				};
				
				mui.neiosRequst.httpRequst('/app/regularWork/neiosStorbatteryCheck/approveStorbatteryCheck', param,
					function(data) {
						if (data.code == '0') {
							mui.toast('提交通过成功！')
							setTimeout(function() {
								mui.back()
								let page = plus.webview.getWebviewById("../sitOperation/terminalwork/terminalwork.html");
								let pageId = plus.webview.getWebviewById(page.id); 
								let param = {} 
								param.isRefresh = true
								mui.fire(pageId, 'isRefresh', param);
							}, 500);
						} else {
							mui.toast('提交通过失败，请稍后重试1！')
						}
					},
					function() {
						mui.toast('提交通过失败，请稍后重试！')
					}
				);
			}
		},
		
	}
});